package leetcode;

/**
 * @Project : AlgorithmLearning
 * @Package : Leetcode
 * @File : Q0343.java
 * @Author : WangRuoyu
 * @Date 2023/11/5 20:59
 */


public class Q0343 {
    public int integerBreak(int n) {
        int[] f = new int[n + 1];
        f[1] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j < i; j++) {
                f[i] = Math.max(f[i], j * (i - j));
                f[i] = Math.max(f[i], j * f[i - j]);
            }
        }
        return f[n];
    }

    public static void main(String[] args) {
        Q0343 sl = new Q0343();
        int n = 10;
        System.out.println(sl.integerBreak(n));
    }
}